﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using System.Text;
using TradeSea;

namespace TradeSea
{
    class Compass
    {
        private float compass;

        public Compass()
        {
        }

        public float getCompass()
        {
            return compass;
        }

        public void setCompass(float q)
        {
            compass = MathHelper.ToDegrees(q);
            if (compass < 0)
            {
                compass += 360;
            }
            if (compass >= 360)
            {
                compass -= 360;
            }
        }

        public string windDir(float f)
        {
            string s = "";

            if (f < 0)
            {
                f += 360;
            }
            if (f >= 360)
            {
                f -= 360;
            }
            if (f == 0 || f == 360)
                s = "North to South";
            else if (f < 90 && f > 0)
                s = "SW";
            else if (f == 90)
                s = "East to West";
            else if (f == 180)
                s = "South to North";
            else if (f > 270 && f < 360)
                s = "SE";
            else if (f == 270)
                s = "West to East";
            else if (f > 180 && f < 270)
                s = "NE";
            else if (f > 90 && f < 180)
                s = "NW";

            return s;
        }
    }
}
